How the Process Manager Creates Processes
How the Process Manager Creates Processes
The information in this section about the Finder information supplements the
description in the Segment Loader.
When a user first opens your application, the Process Manager creates a
partition for it. A partition is a contiguous block of memory that the
Process Manager allocates for the application's use. The partition is
divided into specific areas: application heap, A5 world, and stack. The
application heap contains the application's 'CODE' segment 1, data structures,
resources, and other code segments as needed. The A5 world refers to the
QuickDraw globals, application global variables, and its jump table, all of
which are accessed through the A5 register. The application jump table
contains one entry for every externally referenced routine in every code
segment of your application. The application stack is used to store temporary
variables. See Memory Manager for illustrations of these areas of your
application's partition. When you create an application, you specify in the
'SIZE' resource how much memory you want the
Process Manager to allocate for your application's partition. You specify
two values: the preferred amount of memory to allocate, and the minimum
amount of memory to allocate. When a user opens your application from the
Finder, the Process Manager first attempts to allocate a partition of the
preferred size. If your application cannot be launched in the preferred amount
of memory, the Finder displays a dialog box giving the user the option of
opening the application using less than the preferred size. The Finder will not
launch your application if the minimum amount of memory specified for your
application is not available.
After the Process Manager creates a partition for your application, the
Process Manager loads your code into memory and sets up the stack, heap,
and A5 world ( including the jump table) for your application. If the user
selected one or more files to open or print, the Finder sets up information
your application can use to determine which files to open or print.
The Process Manager assigns the application a process serial number,
records its context, and returns control to the launching application (usually
the Finder). The Process Manager transfers control to the new application
after the launching application makes a subsequent call to WaitNextEvent or
The next section describes how your application can allow other applications
to receive CPU time and how the Process Manager schedules CPU time
among processes.